import request from '@/utils/requset.js'

// 获取我的订单列表
export const getUserInfoAPI = (page, limit) => {
  return request({
    method: 'get',
    url: `/api/order/auth/${page}/${limit}`
  })
}

// 获取 用户地址信息
export const getUserAddressAPI = () => {
  return request({
    method: 'get',
    url: '/api/user/userAddress/auth/findUserAddressList'
  })
}

// 获取 订单交易页信息
export const getOrderTradeAPI = () => {
  return request({
    method: 'get',
    url: '/api/order/auth/trade'
  })
}

// 新增 用户地址信息
export const addUserAddressAPI = (data) => {
  return request({
    method: 'post',
    url: '/api/user/userAddress/auth/save',
    data
  })
}

// 修改 用户地址信息
export const updataUserAddressAPI = (data) => {
  return request({
    method: 'post',
    url: '/api/user/userAddress/auth/update',
    data
  })
}

// 删除 用户地址信息
export const deleUserAddressAPI = (addressId) => {
  return request({
    method: 'get',
    url: `/api/user/userAddress/auth/delete/${addressId}`,
  })
}

// 获取 地区列表
export const findBaseRegionAPI = () => {
  return request({
    method: 'get',
    url: '/api/user/userAddress/auth/findBaseRegion'
  })
}

// 获取 省列表
export const findBaseProvinceAPI = (reginId) => {
  return request({
    method: 'get',
    url: `/api/user/userAddress/auth/findBaseProvinceByRegionId/${reginId}`
  })
}

// 提交 订单
export const submitOrderAPI = (tradeNo, data) => {
  return request({
    method: 'post',
    url: '/api/order/auth/submitOrder?tradeNo=' + tradeNo,
    data
  })
}

// 获取 订单支付信息
export const createNativeAPI = (orderId) => {
  return request({
    method: 'get',
    url: `/api/payment/weixin/createNative/${orderId}`
  })
}

// 查询 支付订单状态
export const queryPayStatusAPI = (orderId) => {
  return request({
    method: 'get',
    url: `/api/payment/weixin/queryPayStatus/${orderId}`
  })
}
